package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.StatisticService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequestMapping("/statistic")
@RestController
public class StatisticController {

    @Autowired
    private StatisticService statisticService;

    @GetMapping("/jobEmpCount")
    public Result jobEmpCount(){
        log.info("统计每个职位的人数");
        JobOption jobOption = statisticService.jobEmpCount();
        return Result.success(jobOption);
    }

    @GetMapping("/genderEmpCount")
    public Result genderCount(){
        log.info("统计性别人数");
        List<Map<String, Object>> list = statisticService.genderCount();
        return Result.success(list);
    }
}
